﻿using System;
using System.Collections.Generic;

namespace HangerSupport
{
	public class HSResultSortCompare : IComparer<HSCalResult>
	{
		public int Compare(HSCalResult curCal, HSCalResult otherOrder)
		{
			this.m_CalInfo = curCal;
			bool flag = this.m_CalInfo.m_hsDefine.m_eType == otherOrder.m_hsDefine.m_eType;
			int result;
			if (flag)
			{
				int num = string.Compare(this.m_CalInfo.m_strHSType, otherOrder.m_strHSType);
				bool flag2 = num != 0;
				if (flag2)
				{
					result = num;
				}
				else
				{
					num = string.Compare(this.m_CalInfo.m_strSizeInfo, otherOrder.m_strSizeInfo);
					bool flag3 = num != 0;
					if (flag3)
					{
						result = num;
					}
					else
					{
						for (int i = 0; i < this.m_CalInfo.m_lstBarList.Count; i++)
						{
							HSCalBarInfo hscalBarInfo = this.m_CalInfo.m_lstBarList[i];
							HSCalBarInfo hscalBarInfo2 = otherOrder.m_lstBarList[i];
							num = string.Compare(hscalBarInfo.m_matInfo.m_strCode, hscalBarInfo2.m_matInfo.m_strCode);
							bool flag4 = num != 0;
							if (flag4)
							{
								return num;
							}
							num = string.Compare(hscalBarInfo.m_matInfo.GetSizeInfo(), hscalBarInfo2.m_matInfo.GetSizeInfo());
							bool flag5 = num != 0;
							if (flag5)
							{
								return num;
							}
							bool flag6 = hscalBarInfo.m_nBarType != hscalBarInfo2.m_nBarType;
							if (flag6)
							{
								return (hscalBarInfo.m_nBarType > hscalBarInfo2.m_nBarType) ? 1 : -1;
							}
						}
						result = 0;
					}
				}
			}
			else
			{
				bool flag7 = this.m_CalInfo.m_hsDefine.m_eType < otherOrder.m_hsDefine.m_eType;
				if (flag7)
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			return result;
		}

		private HSCalResult m_CalInfo;
	}
}
